package org.jeecg.modules.tt_question_collect.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.jeecg.modules.tt_question_collect.entity.TtPlanConfirm;
import org.jeecg.modules.tt_question_collect.entity.TtQuestionCollect;
import org.jeecg.modules.tt_question_collect.entity.TtQuestionFacj;
import org.jeecg.modules.tt_question_collect.entity.wtexport;

import java.util.List;
import java.util.Map;

/**
 * @Description: 出具方案表
 * @Author: jeecg-boot
 * @Date:   2021-03-09
 * @Version: V1.0
 */
public interface WtexportMapper extends BaseMapper<wtexport> {

	Page<wtexport> getwtexportlist(Page<wtexport> pagelist, @Param("wtexport") wtexport wtexport);

    Page<wtexport> getyxjpxlist(Page<wtexport> pagelist, @Param("wtexport") wtexport wtexport);

	@Select("select count(0)as num from tt_question_collect  where sys_org_code = '${bmcode}' ")
    Integer querybmtjdata(@Param("bmcode") String bmcode);

    @Select("select org_code,depart_name from sys_depart ")
    List<Map<String,Object>> getbmcode();

    @Select("select count(0)as num  from tt_audit_record  where sys_org_code = '${bmcode}' and isnew ='1' and scbj = 0 and lclx ='wtlx'")
    Integer querywshnumdata(@Param("bmcode")String org_code);

    @Select("select count(0)as num  from tt_audit_record  where sys_org_code = '${bmcode}' and isnew ='2' and scbj = 0 and lclx ='wtlx'")
    Integer queryyshnumdata(@Param("bmcode")String org_code);

    @Select("select count(0)as num from tt_question_collect  where sys_org_code = '${bmcode}' and auditstatus ='2' and fashbj = '2' ")
    Integer queryfawcnumdata(@Param("bmcode")String org_code);

    @Select("select count(0)as num from tt_question_collect  where sys_org_code = '${bmcode}' and auditstatus ='2' and dealstatus='完成' and scbj ='0' ")
    Integer queryyfwcnumdata(@Param("bmcode")String org_code);

    Page<TtQuestionCollect> queryljtime(Page<TtQuestionCollect> page,@Param("TtQuestionCollect") TtQuestionCollect TtQuestionCollect);

    @Select("select  count(distinct tableid)as num from tt_audit_record where audituserid = '${userid}' and isnew ='2' and scbj ='0'")
    Integer getsprysp(@Param("userid")String userid);

    @Select("select count(distinct tableid)as num from tt_audit_record where audituserid = '${userid}' and isnew ='1' and scbj ='0'")
    Integer getsprdsp(@Param("userid")String userid);

    @Select("select id from sys_role  where role_code ='manager_role'")
    String queryrolelist();


    @Select("select a.id,a.realname from sys_user a join sys_user_role b on a.id = b.user_id where b.role_id = '${roleid}'")
    List<Map<String, Object>> queryuserlist(String roleid);

    @Select("select count(0)as num from tt_audit_record  where audituserid ='${id}' and isnew='1' and lclx ='wtlx' and shbj = '0'and scbj ='0' ")
    String getsyckdspnum(String id);


    @Select("select titlesummary, fileguid from tt_question_collect where id = '${questionid}' ")
    Map<String,Object> getfilelist(String questionid);

    @Select("select fileid from tt_plan_confirm where plan_questionid  = '${questionid}' ")
    String getfaidbyid(String questionid);

    @Select("select fileid from tt_plan_confirm where id ='${s}'")
    Map<String, Object> getfafilelistbyid(String s);


    @Update("update tt_question_collect set highestbj = '${highestbj}' where id = '${id}'")
    void updateyxjbj(String id, Integer highestbj);
}
